package com.szcinda.service.dto.analysis;

import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * 项目数据汇总表
 */
@Data
public class ProjectCountDto implements Serializable {
    // 客户ID
    private String clientId;
    // 客户
    private String client;
    // 机构ID
    private String orgId;
    // 机构
    private String orgName;
    // 业务类型
    private String businessType;
    // 应收运费
    private double incomeTransportFeeRmb;// 人名币
    private double incomeTransportFeeUsd;// 美金
    // 根据当时汇率转成人名币的总和，班列和提货日期
    private double incomeTransportFeeUsdToRmb;
    // 应收杂费
    private double incomeOtherFeeRmb; // 人名币
    private double incomeOtherFeeUsd; // 美金
    // 根据当时汇率转成人名币的总和，班列和提货日期
    private double incomeOtherFeeUsdToRmb;
    // 应收费用
    private double totalIncomeRmb;// 人名币
    private double totalIncomeUsd;// 美金

    // 供应商
    private String carrier;
    // 应付运费
    private double payTransportFeeRmb;// 人名币
    private double payTransportFeeUsd;// 美金
    // 根据当时汇率转成人名币的总和，班列和提货日期
    private double payTransportFeeUsdToRmb;

    // 应付杂费
    private double payOtherFeeRmb; // 人名币
    private double payOtherFeeUsd; // 美金
    // 根据当时汇率转成人名币的总和，班列和提货日期
    private double payOtherFeeUsdToRmb;
    // 应付费用
    private double totalPayRmb;// 人名币
    private double totalPayUsd;// 美金

    // 营业利润
    private double currentAssets;// 人名币


    public void calAssets() {
        this.currentAssets =
                new BigDecimal(this.incomeTransportFeeRmb + this.incomeTransportFeeUsdToRmb + this.incomeOtherFeeRmb + this.incomeOtherFeeUsdToRmb
                        - this.payTransportFeeRmb - this.payTransportFeeUsdToRmb - this.payOtherFeeRmb - this.payOtherFeeUsdToRmb).setScale(4, RoundingMode.UP).doubleValue();
    }

    public void format(){
        this.incomeTransportFeeRmb =
                new BigDecimal(this.incomeTransportFeeRmb).setScale(4, RoundingMode.UP).doubleValue();
        this.incomeTransportFeeUsd = new BigDecimal(this.incomeTransportFeeUsd).setScale(4, RoundingMode.UP).doubleValue();
        this.incomeTransportFeeUsdToRmb = new BigDecimal(this.incomeTransportFeeUsdToRmb).setScale(4, RoundingMode.UP).doubleValue();
        this.incomeOtherFeeRmb = new BigDecimal(this.incomeOtherFeeRmb).setScale(4, RoundingMode.UP).doubleValue();
        this.incomeOtherFeeUsd = new BigDecimal(this.incomeOtherFeeUsd).setScale(4, RoundingMode.UP).doubleValue();
        this.incomeOtherFeeUsdToRmb = new BigDecimal(this.incomeOtherFeeUsdToRmb).setScale(4, RoundingMode.UP).doubleValue();
        this.totalIncomeRmb = new BigDecimal(this.totalIncomeRmb).setScale(4, RoundingMode.UP).doubleValue();
        this.totalIncomeUsd = new BigDecimal(this.totalIncomeUsd).setScale(4, RoundingMode.UP).doubleValue();
        this.payTransportFeeRmb = new BigDecimal(this.payTransportFeeRmb).setScale(4, RoundingMode.UP).doubleValue();
        this.payTransportFeeUsd = new BigDecimal(this.payTransportFeeUsd).setScale(4, RoundingMode.UP).doubleValue();
        this.payTransportFeeUsdToRmb = new BigDecimal(this.payTransportFeeUsdToRmb).setScale(4, RoundingMode.UP).doubleValue();
        this.payOtherFeeRmb = new BigDecimal(this.payOtherFeeRmb).setScale(4, RoundingMode.UP).doubleValue();
        this.payOtherFeeUsd = new BigDecimal(this.payOtherFeeUsd).setScale(4, RoundingMode.UP).doubleValue();
        this.payOtherFeeUsdToRmb = new BigDecimal(this.payOtherFeeUsdToRmb).setScale(4, RoundingMode.UP).doubleValue();
        this.totalPayRmb = new BigDecimal(this.totalPayRmb).setScale(4, RoundingMode.UP).doubleValue();
        this.totalPayUsd = new BigDecimal(this.totalPayUsd).setScale(4, RoundingMode.UP).doubleValue();
        this.currentAssets = new BigDecimal(this.currentAssets).setScale(4, RoundingMode.UP).doubleValue();
    }
}
